package com.example.controller.user;


import com.example.dto.OrdersSubmitDTO;
import com.example.result.Result;
import com.example.service.OrderSubmitService;
import com.example.vo.OrderSubmitVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("userOrderSubmitController")
@RequestMapping("/user/order")
@Tag(name = "用户端用户下单")
@Slf4j
public class OrderSubmitController {

    @Autowired
    private OrderSubmitService orderSubmitService;

    /**
     * 用户下单
     */
    @PostMapping("/submit")
    @Operation(summary = "用户下单")
    public Result submit(@RequestBody OrdersSubmitDTO ordersSubmitDTO){
        log.info("用户下单：{}",ordersSubmitDTO);
        OrderSubmitVO orderSubmitVO=orderSubmitService.submit(ordersSubmitDTO);
        return  Result.success(orderSubmitVO);
    }
}
